import { floatToFixed2 } from '@/utils'
import {getIntDictOptions, getStrDictOptions} from "@/utils/dict";

// 格式化金额【分转元】
// @ts-ignore
export const fenToYuanFormat = (_, __, cellValue: any, ___) => {
  return `￥${floatToFixed2(cellValue)}`
}


export const logicDictFormatter = (key: bigint) => {
  const options: any[] = getIntDictOptions(DICT_TYPE.LOGIC_STATUS);
  const option = options.find(option => option.value === key);
  return option ? option.label : '否';
}

export const dictFormatterIntKey = (dictType:string, key:bigint) => {
  const options: any[] = getIntDictOptions(dictType);
  const option = options.find(option => option.value === key);
  return option ? option.label : '';
}

export const dictFormatterStrKey = (dictType:string, key:string) => {
  const options: any[] = getStrDictOptions(dictType);
  const option = options.find(option => option.value === key);
  return option ? option.label : '';
}
